﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.Collections;

namespace WebVideo.Areas.Admin.Models
{
    public class ReportProductPointModel
    {
        public int Id { get; set; }
        public string UserName { get; set; }
        public int IdProduct { get; set; }
        public DateTime Date { get; set; }
        public string PhoneNumber { get; set; }
        public int Status { get; set; }

        public static IEnumerable<EntityReport_PoductPoint> Index()
        {
            dbVideoDataContext db = new dbVideoDataContext();
            var query = from p in db.EntityReport_PoductPoints
                        orderby p.Date descending
                        select p;
            return query.ToList();
        }

        public static void Ban(int Id, int l)
        {
            dbVideoDataContext db = new dbVideoDataContext();

            EntityReport_PoductPoint tnew = db.EntityReport_PoductPoints.Where(p => p.Id == Id).Single();
            tnew.Status = l;
            db.SubmitChanges();

        }
        public static void Delete(int Id)
        {
            dbVideoDataContext db = new dbVideoDataContext();

            EntityReport_PoductPoint faq = db.EntityReport_PoductPoints.Where(p => p.Id == Id).Single();
            db.EntityReport_PoductPoints.DeleteOnSubmit(faq);
            db.SubmitChanges();
        }
    }
}